package com.gxa.weixing.pc.controller;

import com.gxa.weixing.core.common.JsonResult;
import com.gxa.weixing.pc.service.WorkBenchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ClassName WorkBench
 * @Author: ws
 * @date 2022/1/10 10:12
 */
@RestController
@Api(tags = "工作台api")
@RequestMapping("/workBench")
public class WorkBenchController {

    @Autowired
    WorkBenchService workBenchService;

    @ApiOperation("获取 营业数据(businessData) 和 销售情况(marketData)")
    @GetMapping("/getData")

    public Map getData(){
        Map<String, Long> businessData = workBenchService.getBusinessData();
        Map<String, Object> marketData = workBenchService.getMarketData();

        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.put("businessData",businessData);
        jsonResult.put("marketData",marketData);
        return jsonResult.getDataMap();
    }

}
